#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;

string s;
int judge(string s, int l, int r)
{
    if (l != r && s[l] == s[r])
        l--, r++;
    while (l >= 0 && r < s.size())
    {
        if (s[l] == s[r]) l--, r++;
        else break;
    }

    return (r - 1) - l;
}
int main()
{
    getline(cin, s);
    int maxnum = 0;
    for (int i = 0; i < s.size() - 1; i++)
    {
        maxnum = max(maxnum, judge(s, i, i));
        maxnum = max(maxnum, judge(s, i, i + 1));
    }

    printf("%d", maxnum);
    return 0;
}